<%--
  Created by IntelliJ IDEA.
  User: q
  Date: 2018/2/13
  Time: 22:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script type="text/javascript"
            src="${pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript">
        function request_json(){
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath }/items/editItemSubmit_RequestJson",
                contentType:"application/json;charset=utf-8",
                data:'{"name":"测试商品","price":99.9}',
                success:function(data){
                    alert(data.name);
                }
            });
        }
        function response_json(){
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath }/items/editItemSubmit_ResponseJson",
                data:'name=测试商品2&price=10',
                success:function(data){
                    alert(data.name);
                }
            });
        }

    </script>
    <title>Title</title>
</head>
<body>
<input type="button" value="提交json返回json" onclick="request_json()">
<input type="button" value="提交keyvalue返回json" onclick="response_json()">
</body>
</html>
